%--------------------------------------------------------------------------
%   rt toolbox
%   author:qwe14789cn@gmail.com
%   https://github.com/qwe14789cn/radar_tools
%--------------------------------------------------------------------------
%   rt.dbm2vpp(dbm,R)
%--------------------------------------------------------------------------
%   Description:
%   dbm to volt 
%--------------------------------------------------------------------------
%   input:
%           dbm                 signal peak to peak volt
%           R                   resistance(default=50)
%   output:
%           vpp
%--------------------------------------------------------------------------
%   Examples:   
%   rt.dBm2vpp(0)
%   ans = 0.6325
%   rt.dbm2vpp(1,50)
%   ans = 0.7096
%--------------------------------------------------------------------------
function vpp = dbm2vpp(dbm,R)
if nargin==1
    R=50;
end
vpp = 2*10.^((dbm-30+10*log10(2.*R))./20);
end